package com.zego.wawaji.ui.view.marquee;

import android.content.Context;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.zego.wawaji.R;

/**
 * 主页提示消息跑马灯布局
 * Created by Su on 2018/2/28.
 */
public class TipsMainView extends LMarqueeFactory<LinearLayout, String> {
    private TextView tips_text;

    public TipsMainView(Context mContext) {
        super(mContext);
    }

    @Override
    public LinearLayout generateMarqueeItemView(String data) {
        LinearLayout linearLayout = (LinearLayout) inflate(R.layout.tips_main_marquee);
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        linearLayout.setLayoutParams(params);

        tips_text = (TextView) linearLayout.findViewById(R.id.tips_text);
        tips_text.setBackground(null);
        tips_text.setText("");
        tips_text.setGravity(Gravity.CENTER);
        if (!TextUtils.isEmpty(data)) {
            tips_text.setBackgroundResource(R.drawable.bg_radius_black70);
            tips_text.setText(data);
        }
        return linearLayout;
    }
}
